// http请求工具类

import { http, httpFormData } from '@/js/util/connect.js';
import config from "@/js/util/config.js";

let service = 'interact';

export default {
    // 登录
    login: (param, method = 'POST', type = 'json', callback = null) => http(config.getLoginURL() + `${service}/user/login`, param, method, type, callback),
    // token登录
    getUserToken: (param, method = 'POST', type = 'json', callback = null) => http(config.getLoginURL() + 'service/user/login', param, method, type, callback),
    // 获取验证码
    getValidateCode: (param, method = 'POST', type = 'json', callback = null) => http(config.getLoginURL() + `${service}/user/code/validate`, param, method, type, callback),
    // 获取短信验证码
    getUserCode: (param, method = 'POST', type = 'json', callback = null) => http(config.getLoginURL() + `${service}/user/code/get`, param, method, type, callback),
    // 重置密码
    resetPassword: (param, method = 'POST', type = 'json', callback = null) => http(config.getLoginURL() + `${service}/user/password/reset`, param, method, type, callback),
    // 注册
    register: (param, method = 'POST', type = 'json', callback = null) => http(config.getLoginURL() + `${service}/user/insert`, param, method, type, callback),
    // 查看模板
    getTemplate: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/scene/template/one`, param, method, type, callback),
    // 不需要token查看模板
    previewGetTemplate: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/scene/template/detail`, param, method, type, callback),
    // 模板、项目列表
    getTemplateList: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/scene/template/list`, param, method, type, callback),
    // 新增项目
    insertTemplate: config.getServiceURL('scene') + `service/scene/template/insert`,
    // 复制项目
    copyTemplate: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/scene/template/copy`, param, method, type, callback),
    // 删除项目
    deleteTemplate: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/scene/template/delete`, param, method, type, callback),
    // 修改项目
    updateTemplate: config.getServiceURL('scene') + `service/scene/template/update`,
    // 获取上传oken
    getUploadToken: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/scene/upload/token`, param, method, type, callback),
    // 获取图片 视频 资源列表
    getResourceList: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/scene/resource/list`, param, method, type, callback),
    // 删除资源
    deleteResource: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/scene/resource/delete`, param, method, type, callback),
    // 获取自定义方案颜色
    getCustomMatchList: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/scene/color/list`, param, method, type, callback),
    // 添加自定义方案颜色
    insertCustomMatch: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/scene/color/insert`, param, method, type, callback),
    // 删除自定义颜色
    deleteCustomMatch: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/scene/color/delete`, param, method, type, callback),
    // 修改自定义颜色
    updateCustomMatch: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/scene/color/update`, param, method, type, callback),
    // 自定义组件列表
    getSimpleList: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/scene/element/list`, param, method, type, callback),
    // 删除自定义组件
    deleteSimple: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/scene/element/delete`, param, method, type, callback),
    // 删除子组件
    deleteSimpleFile: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/scene/element/file/delete`, param, method, type, callback),
    // 获取子组件内容详情
    getSimpleFile: (param, method = 'POST', type = 'text', callback = null) => http(config.getServiceURL('scene') + `service/scene/element/file/one`, param, method, type, callback),
    // 我的分享 列表
    getShareList: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/share/list`, param, method, type, callback),
    // 我的分享 删除
    deleteShare: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/share/delete`, param, method, type, callback),
    // 我的分享 修改
    updateShare: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/share/update`, param, method, type, callback),
    // 我的分享 启动
    enableShare: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/share/enable`, param, method, type, callback),
    // 我的分享 禁用
    disableShare: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/share/disable`, param, method, type, callback),
    // 获取回收站模板列表
    getRecycleTemplateList: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/scene/template/delete/list`, param, method, type, callback),
    // 恢复删除的模板
    recoverRecycleTemplateList: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/scene/template/delete/insert`, param, method, type, callback),
    // 编辑子组件
    uodateSimpleFile: config.getServiceURL('scene') + `service/scene//element/file/update`,
    // 新增子组件
    addSimpleFile: config.getServiceURL('scene') + `service/scene//element/file/insert`,
    // 分享项目
    addShare: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/share/insert`, param, method, type, callback),
    // 分享项目
    downloadProject: config.getServiceURL('scene') + `service/access/dtscharts/download`,
    // 上传授权文件
    uploadLic:  (param, method = 'POST', type = 'json', callback = null) => httpFormData(config.getLoginURL() + `service/license/upload`, param, method, type, callback),
    // 获取机器码
    getLicenseCode:  (param, method = 'get', type = 'json', callback = null) => http(config.getLoginURL() + `service/license/code`, param, method, type, callback),
    // 检查授权是否过期
    getLicenseQuery:  (param, method = 'get', type = 'json', callback = null) => http(config.getLoginURL() + `service/license/query`, param, method, type, callback),
    // 分享快捷方式
    addtShortcut:  (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/share/shortcut/insert `, param, method, type, callback),
    // 判断是否可以删除资源
    deleteMediaCheck: (param, method = 'POST', type = 'json', callback = null) => http(config.getServiceURL('scene') + `service/scene/resource/employ `, param, method, type, callback)
};